package cn.zjutleo.village_server.controller;

import cn.zjutleo.village_server.service.StarAndColletService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: 张坤
 * @DateTime: 2021/12/7 16:23
 * @Description: 该类用于 TODO
 */
@Api(tags = "点赞收藏模块")
@RestController
@RequestMapping("/api/starAndPolicy")
public class StarAndColletController {
    @Autowired
    StarAndColletService starAndColletService;
    /**
     * 点赞功能
     */
    @ApiOperation("点赞")
    @PostMapping("/addCollet")
    public int addCollet(int userId,int policyId){
        return starAndColletService.addCollet(userId,policyId);
    }
    /**
     * 收藏功能
     */
    @ApiOperation("收藏")
    @PostMapping("/addStar")
    public int addStar(int userID,int policyID){
        return starAndColletService.addStar(userID,policyID);
    }
    /**
     * 取消收藏功能
     */
    @ApiOperation("取消收藏收藏")
    @PostMapping("/cancelCollet")
    public int cancelCollet(int userID,int policyID){
        return starAndColletService.cancelCollet(userID,policyID);
    }
    /**
     * 取消点赞功能
     */
    @ApiOperation("取消点赞收藏")
    @PostMapping("/cancelStar")
    public int cancelStar(int userID,int policyID){
        return starAndColletService.cancelStar(userID,policyID);
    }

    /**
     * 查询点赞功能
     */
    @ApiOperation("查询点赞")
    @PostMapping("/selectCollet")
    public long selectCollet(int policyID){
        return starAndColletService. selectCollet(policyID);
    }
    /**
     * 查询收藏功能
     */
    @ApiOperation("查询收藏")
    @PostMapping("/selectStar")
    public long selectStar(int policyID){
        return starAndColletService.selectStar(policyID);
    }

}
